using System;
using System.Collections.Generic;
using System.Text;

namespace WorkTracker.BusinessObjects
{
	/// <summary>
	/// Represents one status change of a user.
	/// </summary>
	public class StatusChange
	{

		#region Properties

		/// <summary>
		/// User of the status change.
		/// </summary>
		public User User {
			get { return _user; }
			set { _user = value; }
		}
		private User _user;

		/// <summary>
		/// Date/Time when change occured.
		/// </summary>
		public DateTime Date {
			get { return _date; }
			set { _date = value; }
		}
		private DateTime _date = DateTime.Now;

		/// <summary>
		/// Status of the change.
		/// </summary>
		public eStatus Status {
			get { return _status; }
			set {
				if (!Enum.IsDefined(typeof(eStatus), value))
					throw new ArgumentException("Status must be a member of eStatus enumeration", "value");
				_status = value; 
			}
		}
		private eStatus _status = eStatus.NotWorking;

		#endregion

		/// <summary>
		/// Possible change statuses.
		/// </summary>
		public enum eStatus
		{
			/// <summary>
			/// User is working.
			/// </summary>
			Working = 1,

			/// <summary>
			/// User is on a break.
			/// </summary>
			WorkBreak = 2,

			/// <summary>
			/// User is not working.
			/// </summary>
			NotWorking = 3

		}


		public class StatusEnumItems
		{
			public eStatus Value {
				get { return _value; }
				set { _value = value; }
			}
			private eStatus _value;

			public string Display {
				get { return _display; }
				set { _display = value; }
			}
			private string _display;

			private StatusEnumItems(eStatus value, string display) {
				_value = value;
				_display = display;
			}


			public static List<StatusEnumItems> GetStatusEnumItems() {
				List<StatusEnumItems> list = new List<StatusEnumItems>();
				foreach (eStatus value in Enum.GetValues(typeof(eStatus))) {
					list.Add(new StatusEnumItems(value, Enum.GetName(typeof(eStatus), value)));
				}
				return list;
			}

		}

	}
}
